#pragma once
#include <wdm.h>

namespace windows {
namespace kernal {
class Device {
 public:
  static NTSTATUS ReadDispatch(_In_ PDEVICE_OBJECT device_object, _In_ PIRP irp);

  Device(PDRIVER_OBJECT driver_object);
  ~Device();
  NTSTATUS Create(_In_ LPCWSTR device_name, _In_ LPCWSTR symbolic_link_name);
  VOID Destroy();

  NTSTATUS InternalDeviceControl(_In_ LPCWSTR target_device_name,
                                 _In_ ULONG major_function, _In_ PVOID buffer,
                                 _In_ ULONG length);

 private:
  NTSTATUS CreateDevice(_In_ LPCWSTR device_name);

  NTSTATUS CreateSymbolicLink(_In_ LPCWSTR symbolic_link_name);

  NTSTATUS FormatDeviceName(_In_ LPCWSTR device_name,
                            _Out_ LPWSTR standard_device_name,
                            _Inout_ SIZE_T *size);

  NTSTATUS FormatSymbolicLinkName(_In_ LPCWSTR symbolic_link_name,
                                  _Out_ LPWSTR standard_symbolic_link_name,
                                  _Inout_ SIZE_T *size);

 private:
  PDRIVER_OBJECT driver_object_;
  WCHAR device_name_[0x100];
  WCHAR symbolic_link_name_[0x100];
  PDEVICE_OBJECT device_object_;
};
}
};




